﻿<?xml version="1.0" encoding="utf-8" ?>
<AdoNetDataAccess connection="$SyrinxDBConnection$" formatter="bizobj of TreeNodeInfo">
	<Sql>
		SELECT 
			'x' as id, COUNT(c.id) as numberOfDirectChildren
		FROM 
			ObjectTreeNodes as t
		LEFT OUTER JOIN ObjectTreeCounts as c on c.objectId = t.objectId
		WHERE 
			((@parentHostId is NULL AND t.id = t.parentHostId) OR
			 (t.parentId=@parentHostId AND id &lt;&gt; t.parentHostId))
			AND c.treeName = @treeName
	</Sql>
	<Param name="parentHostId" type="UniqueIdentifier"/>
	<Param name="treeName" type="UnicodeVarChar" />
</AdoNetDataAccess>
